

namespace WooEngine.Utility.Security.Base
{

	[System.Serializable]
	public class EncryptLong
	{
		public static System.Random random = new System.Random();

		private long LONG_SECRET_KEY = 1;

		private long _value = 1;
		public long Value
		{
			set { _value = value ^ LONG_SECRET_KEY; }
			get { return _value ^ LONG_SECRET_KEY; }
		}

		public EncryptLong()
		{
			LONG_SECRET_KEY = random.Next(0, 255);// Convert.ToLong32((Time.time * 1000));
		}

		public static EncryptLong Get(long v)
		{
			EncryptLong ei = v;
			return ei;
		}

		public static implicit operator EncryptLong(long value)
		{
			EncryptLong encryptLong = new EncryptLong();
			encryptLong.Value = value;

			return encryptLong;
		}

		public static implicit operator long(EncryptLong encryptLong)
		{
			return encryptLong.Value;
		}

		public static bool operator ==(EncryptLong _a, EncryptLong _b)
		{
			return _a.Value == _b.Value;
		}

		public static bool operator !=(EncryptLong _a, EncryptLong _b)
		{
			return _a.Value != _b.Value;
		}

		public override bool Equals(object obj)
		{
			return Value.Equals((obj as EncryptLong).Value);
		}

		public override int GetHashCode()
		{
			return Value.GetHashCode();
		}

		public string ToString(string format)
		{
			return Value.ToString(format);
		}

		public override string ToString()
		{
			return Value.ToString();
		}
	}

}